package com.xy.xymall.cart.config;

import com.xy.xymall.cart.interceptor.CartInterceptor;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

/**
 * @author XY
 * @version 1.0
 * @date 2020/10/27 16:23
 * @Description
 */
@Configuration
public class MyWebConfig implements WebMvcConfigurer {

    /**
     * @param registry
     * @author XY
     * @date 2020/10/27 16:47
     * @return void
     * 配置拦截器，拦截所有请求
     */
    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        registry.addInterceptor(new CartInterceptor()).addPathPatterns("/**");
    }
}
